<template>
  <el-container>
    <el-header >
      <h2>{{curArtInfo.title}}</h2>
      <div>
        <span>{{parseDate(curArtInfo.createTime)}}</span>
        <span>{{curArtInfo.username}}</span>
        <span>
          <i class="el-icon-view"></i>
          <!-- <svg-icon class-name='international-icon' icon-class="eye" /> -->
        </span>
        <span>{{curArtInfo.visits}}</span>
      </div>
    </el-header>
    <el-main >
        {{parseHtml(curArtInfo.articleBody)}}
    </el-main>
  </el-container>
</template>

<script>
// 引入工具方法
import { parseTime, html2Text } from '@/utils'
export default {
  props: {
    curArtInfo: {
      type: Object,
      required: true
    }
  },
  methods: {
    // 解析事件
    parseDate (value) {
      return parseTime(value)
    },
    // 解析html
    parseHtml (value) {
      return html2Text(value)
    }
  }
}
</script>

<style scoped lang='scss'>
  .el-container{
    .el-header {
      height: 60px;
      h2 {
        line-height: 24px;
        margin: 0;
      }
      >div {
        padding-left: 7px;
        margin-top: 10px;
        >span {
          margin-left: 7px;
        }
      }
    }
    .el-main {
      background: #f5f5f5;
      border-top: 1px dashed #ccc;
    }
  }
</style>
